﻿using Common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChatRequest : BaseRequest
{
	Transform screen;
	ChatPanel chatPanel;
	public override void Start() {
		requestCode = RequestCode.Game;
		actionCode = ActionCode.Chat;
		screen = GameObject.Find("Canvas").transform.Find("ReceiveScreen");
		chatPanel = GetComponent<ChatPanel>();
		base.Start();
	}

	public Queue<string> queues = new Queue<string>();


	public void RequestChat(string data) {
		SendRequest(data);

		string s = "Local:" + data;
		Debug.Log(s);
		chatPanel.ShowChat(s);
	}

	public override void OnResponse(string data) {
		base.OnResponse(data);

		string s = "Remote:" + data;
		Debug.Log(s);
		// Debug.Log(chatPanel.name);

		queues.Enqueue(s);

		screen.Find("Tag").localScale = Vector3.one;
	}
}
